dcfandomcom-20200222-history
Template talk:Issue Images
So the breakdown of the title is in two parts, and both parts use the #explode: function. Explode works like this: "How now Brown Cow" is the part you want to split up into smaller parts. "Brown" is the place where you want the part to be split at. "1" is the section you want returned. "0" or not specified in 1's position would return everything before "Brown", where as the way it's stated above will return " Cow". Spaces before and after any section are ignored because spaces are special characters. So to use this in the title, we need to know a couple things. #1, what is ALWAYS in the title. (Vol and Spaces). #2 What separates the title from the volume number, and the volume number from the issue number. (Vol in the first case, and spaces in the second). From there, it becomes a simple matter of splitting the title into sections: or returns the same thing: "Title" and gives us: "Volume Issue", so to split these two parts further, we need to explode (split) around the space: | |0}} or | }} returns: "Volume" | |1}} returns: "Issue" Note two things. #1, having one space in the "what to split around" part is the only place a space is recognized for this function. #2, We've nested the two functions, so we are essentially performing the second split (around the space) on the part we've already split (around the 'Vol'). So there's how I split up the title. I've done similar things for the Character's titles, pulling out the Universe field when it exists. (Which doesn't always work because there could be multiple parts inside parenthesis in the title, and there's no way to really know for sure that there are one or multiple). To do what you'd like, having only the title in italics, you'd have to try to explode out the title only from any input you put into the Template you're doing it in. looks for 'Vol' in the input, and if it isn't there, assumes it's a Vol 1, and looks for a '#' to put the Vol 1 into. If there's no 'Vol' and no '#' then it just returns what it was given as with and around it. So for yours, you'd need to know what you and other users of the template will ALWAYS be putting into the input. And now you see what is the hardest part about template creation, anticipating what the user will put into the template. This is always super hard because most people don't even look at the documentation for the template, but just put in what they 'think' should go there, or what goes there based on how the template has been filled out in the past. Whew! — Nathan (Peteparker) (Earth-1218) (talk • • ) 15:51, 12 November 2008 (UTC) :Okay, I think I've absorbed this (finally). What I'm wanting to do here is get a value from the page name that is the title and volume, but not the issue number, and use that to autocat the issue images category into the corresponding volume category. How is that accomplished with a variable ( ) instead of a string? The Paradox 12:40, 27 November 2008 (UTC) ::Cool! :) ::A string is any combination of single characters treated as one big thing, so is treated as a full string as well. ::So pulling out the title and volume means you know, no matter what the pagename is, where those things are in the title. This is probably very difficult since Images don't have standardized names that are enforced across the wiki just yet. It's easy with the comic pages, because we standardized the titles, making them all "Title Vol Volume Issue". So it's still possible to do with images, but is probably best used with the 'Issue' field instead of the PAGENAME. The way you'd make sure the issue fields are standardized would be using a cousin template of the Cnst one called CnstNL. CnstNL does the same thing as the Cnst template, but returns the result without the brakets around it, so it's not yet a link. In theory, it should always return the comic in the standardized format. From there, you can use explode to remove the parts you want and put them together as you see fit. Here's an example: :: }|Vol}} ::This will get you the title, since it always happens before the Vol part of the standardized title. ::Then, you need the volume number: :: }|Vol|1}} ::This only gets you the Volume Number, then a space, and then the Issue Number, and since you know they're separated by a space, so you need to explode this piece again: :: }|Vol|1}} | }} ::So there's the Volume number. Now that you have code to pull out these two parts, you can put them back together in the way you need: :: }|Vol}} Vol }|Vol|1}} | }} ::Would be "Title Vol VolumeNumber" ::You could possibly do all this with the PAGENAME, but it will probably be much more difficult since most Images don't include the Comic they're from in the title, and when they do, they're hardly in a standardized format. ::— Nathan (Peteparker) (Earth-1218) (talk • • ) 17:59, 27 November 2008 (UTC)